import request from '@/utils/request'

// 销售人员
export function salesman(query) {
  return request({
    url: '/erp_api/zhouyz/salesman/list',
    method: 'get',
    params: query
  })
}

// 销售人员详情
export function salesmanDetail(query) {
  return request({
    url: `/erp_api/zhouyz/salesman/${query.id}`,
    method: 'get'
  })
}

// 销售需求
export function salesmanDemand(query) {
  return request({
    url: '/erp_api/zhouyz/salesmanDemand/list',
    method: 'get',
    params: query
  })
}

// 销售需求详情
export function salesmanDemandDetail(query) {
  return request({
    url: `/erp_api/zhouyz/salesmanDemand/${query.id}`,
    method: 'get'
  })
}

// 销售需求商品
export function salesmanDemandProduct(query) {
  return request({
    url: `/erp_api/zhouyz/salesmanDemand/product/detail`,
    method: 'get',
    params: query
  })
}

// 销售路线
export function salesmanPath(query) {
  return request({
    url: '/erp_api/zhouyz/salesman/path/list',
    method: 'get',
    params: query
  })
}

// 销售路线点详情
export function salesmanPathPoint(query) {
  return request({
    url: `/erp_api/zhouyz/salesman/path/${query.id}`,
    method: 'get'
  })
}

// 销售线索
export function salesmanClue(query) {
  return request({
    url: '/erp_api/zhouyz/salesman/clue/list',
    method: 'get',
    params: query
  })
}

// 销售线索详情
export function salesmanClueDetail(query) {
  return request({
    url: `/erp_api/zhouyz/salesman/clue/${query.id}`,
    method: 'get'
  })
}

// 线索跟进
export function salesmanClueFollow(query) {
  return request({
    url: '/erp_api/zhouyz/salesman/clue/follow/list',
    method: 'get',
    params: query
  })
}

// 试品明细
export function salesmanClueFollowProduct(query) {
  return request({
    url: '/erp_api/zhouyz/salesman/clue/follow/product/list',
    method: 'get',
    params: query
  })
}

// 销售打卡
export function salesmanPathAdd(data) {
  return request({
    url: '/erp_api/zhouyz/salesman/path',
    method: 'post',
    data: data
  })
}

// 编辑销售路线
export function salesmanClueAdd(data) {
  return request({
    url: '/erp_api/zhouyz/salesman/clue',
    method: data.id ? 'put' : 'post',
    data: data
  })
}

// 删除销售路线
export function salesmanClueDel(data) {
  return request({
    url: `/erp_api/zhouyz/salesman/clue/${data.id}`,
    method: 'delete'
  })
}


// 线索跟进详情
export function salesmanClueFollowDetail(query) {
  return request({
    url: `/erp_api/zhouyz/salesman/clue/follow/${query.id}`,
    method: 'get'
  })
}


// 编辑线索跟进
export function salesmanClueFollowAdd(data) {
  return request({
    url: '/erp_api/zhouyz/salesman/clue/follow',
    method: data.id ? 'put' : 'post',
    data: data
  })
}

// 删除线索跟进
export function salesmanClueFollowDel(data) {
  return request({
    url: `/erp_api/zhouyz/salesman/clue/follow/${data.id}`,
    method: 'delete'
  })
}

// 编辑销售需求
export function salesmanDemandAdd(data) {
  return request({
    url: '/erp_api/zhouyz/salesmanDemand',
    method: data.id ? 'put' : 'post',
    data: data
  })
}


// 暂存销售需求商品
export function salesmanDemandProductAdd(data) {
  return request({
    url: '/erp_api/zhouyz/salesmanDemand/product/detail',
    method: 'post',
    data: data
  })
}

// 删除销售需求
export function salesmanDemandDel(query) {
  return request({
    url: `/erp_api/zhouyz/salesmanDemand/${data.id}`,
    method: 'delete'
  })
}

// 试品明细详情
export function salesmanClueFollowProductDetail(query) {
  return request({
    url: `/erp_api/zhouyz/salesman/clue/follow/product/${query.id}`,
    method: 'get'
  })
}

// 编辑试品明细
export function salesmanClueFollowProductAdd(data) {
  return request({
    url: '/erp_api/zhouyz/salesman/clue/follow/product',
    method: data.id ? 'put' : 'post',
    data: data
  })
}

// 审核试品
export function salesmanClueFollowProductAudit(data) {
  return request({
    url: '/erp_api/zhouyz/salesman/clue/follow/product/audit',
    method: 'put',
    data: data
  })
}

// 试品发货
export function salesmanClueFollowProductSend(data) {
  return request({
    url: '/erp_api/zhouyz/salesman/clue/follow/product/send',
    method: 'put',
    data: data
  })
}

// 到店试品
export function salesmanClueFollowProductTest(data) {
  return request({
    url: `/erp_api/zhouyz/salesman/clue/follow/product/test/${data.clueFollowProductId}/${data.clueFollowId}`,
    method: 'put'
  })
}

// 申请试品商品列表
export function salesmanClueFollowProductClueProduct(query) {
  return request({
    url: `/erp_api/zhouyz/salesman/clue/follow/product/clue-product/${query.warehouseId}`,
    method: 'get'
  })
}

// 删除试品明细
export function salesmanClueFollowProductDel(data) {
  return request({
    url: `/erp_api/zhouyz/salesman/clue/follow/product/${data.id}`,
    method: 'delete'
  })
}

// 判断商户池是否重复
export function salesmanCluePhone(phone) {
  return request({
    url: `/erp_api/zhouyz/salesman/clue/list/${phone}`,
    method: 'get'
  })
}